/**
 * 
 */
package org.swing.utility.input.action;

import java.awt.event.ActionEvent;

import javax.swing.AbstractAction;

import org.swing.utility.input.trigger.Trigger;

/**
 * @author  Le Quynh Nhu
 *
 */
public class ArmingAction extends AbstractAction {
    private Trigger trigger;
    private boolean arm;

    /**
     * @param trigger
     */
    public ArmingAction(Trigger trigger, String command, boolean arm) {
        this.trigger = trigger;
        this.arm = arm;
        putValue(ACTION_COMMAND_KEY, command);
    }

    public void actionPerformed(ActionEvent e) {
        if (arm) {
            trigger.arm(e);
        } else {
            trigger.disarm(e);
        }
    }
}
